const HOST = `//24.46.147.178:7001`
const prifix = '/aqsc-web/public/services'

import Vue from 'vue'
	
function setFetch(token=sessionStorage.getItem('token')||'') {
	Vue.prototype.$fetch = (type, url, data={}) => {	
		let option = {
			header: {
				'Access-Token': token
			},
			url,
			method: type,
			data: {
				action: 'aqgqj-web', 
				...data
			}
		}
		
		let promise = new Promise(function(resolve, reject) {
			uni.request(option)
			.then(res => {
				resolve(res[1])
			})
			.catch(err => {
				reject(err)
			})
		})
		
		return promise
	}
}



export {
	HOST, prifix, setFetch
}